package org.locker.mapper;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import org.locker.device.dto.ManagerClientQueryDto;
import org.locker.domain.Order;
import org.locker.domain.bo.OrderBo;
import org.locker.domain.vo.*;
import org.locker.common.mybatis.core.mapper.BaseMapperPlus;

import java.util.List;
import java.util.Map;

/**
 * 订单Mapper接口
 *
 * @author winnie
 * @date 2023-10-11
 */
public interface OrderMapper extends BaseMapperPlus<Order, OrderVo> {

    /**
     * 根据id查询订单信息
     * @param oderId
     * @return
     */
    OrderVo getById(Long oderId);

    /**
     * 根据条件查询订单列表
     * @param page
     * @param bo
     * @return
     */
    Page<OrderVo> list(IPage<OrderVo> page, @Param("bo") OrderBo bo);

    Page<OrderFlowVo> queryOrderFlow(IPage<OrderFlowVo> page, @Param("dto") ManagerClientQueryDto queryDto);

    Page<PositionFlowVo> queryPositionFlow(IPage<PositionFlowVo> page, @Param("dto") ManagerClientQueryDto queryDto);

    Page<DeviceFlowVo> queryDeviceFlow(IPage<DeviceFlowVo> page, @Param("dto") ManagerClientQueryDto queryDto);


    Page<PositionFlowVo> queryPositionFlowByData(IPage<PositionFlowVo> page, @Param("dto") ManagerClientQueryDto queryDto);

    Page<DeviceFlowVo> queryDeviceFlowByData(IPage<DeviceFlowVo> page, @Param("dto") ManagerClientQueryDto queryDto);

    /**
     * 查询近七天数据
     * @param queryDto
     * @return
     */
    List<DailyOrderVo> sevenDaysData(@Param("dto") ManagerClientQueryDto queryDto);
    DailyOrderVo statistics(@Param("dto") ManagerClientQueryDto queryDto);

    /**
     * 根据时间范围查询
     * @param queryDto
     * @return
     */
    List<DailyOrderVo> queryByDateRange(@Param("dto") ManagerClientQueryDto queryDto);

    List<Map<String,Integer>> getOrderNumByDeviceId(@Param("dto") ManagerClientQueryDto queryDto);

    /**
     * 按月查询订单信息
     * @param page
     * @param queryDto
     * @return
     */
    Page<OrderDetailVo> queryOrderByDay(IPage<OrderDetailVo> page, @Param("dto") ManagerClientQueryDto queryDto);
}
